package com.lihua.newideas.mapper;

import com.lihua.newideas.pojo.MyUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface MyUserMapper {
    //根据用户名查询用户信息
    MyUser queryUserByName(String username);
    //插入user
    void insertUser(MyUser user);
//    根据用户名和密保修改密码
    @Update("update myuser set passWord = #{passWord} where userName = #{userName} and code = #{code}")
    void updateUserByUserName(@Param("passWord") String passWord, @Param("userName") String userName, @Param("code") String code);

    /*根据用户名进行修改*/

    void updateMyUserByUserName(MyUser user);

    //查询用户总数
    @Select("select count(*) from myuser")
    int queryUserNum();

    /*
    * 查询所有用户
    * */
    @Select("select * from myuser")
    List<MyUser> queryUserAll();

    /*根据用户id删除用户
    * */
    @Delete("delete from myuser where id = #{id} ")
    void deleteMyUserById(@Param("id") int id);

}
